package com.mate.cloud.auth.controller;

import com.mate.cloud.auth.param.UserRegister;
import com.mate.cloud.auth.service.UserService;
import com.mate.cloud.common.response.BaseResponse;
import com.mate.cloud.common.web.controller.AdminBaseController;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 构建注册接口
 *
 * @author: MI
 * @email: 448341911@qq.com
 * @createTime: 2025/6/6 16:58
 * @updateUser: MI
 * @updateTime: 2025/6/6 16:58
 * @updateRemark: 修改内容
 * @version: 1.0
 */
@Slf4j
@RestController
@RequestMapping("/user")
@RequiredArgsConstructor
public class RegisterController extends AdminBaseController {


    private final UserService userService;

    /**
     * 注册用户
     *
     * @param userRegister
     * @return
     */
    @PostMapping("/register")
    public BaseResponse register(@RequestBody UserRegister userRegister) {
        log.info("register user: {}", userRegister);
        return successBodyCondition(userService.register(userRegister));
    }
}
